home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
STUTTGART
/
ETC
/
UNIXEXTRA
< prev
Wrap
Text File
|
1991-05-15
|
2KB
|
48 lines
#!/bin/awk -f
#
# There have been several questions recently about how to handle
# comp.binaries.acorn postings on a un*x box. Here's one way.....
#
# Because of the way !Extract works, and tries to be filing system/path
# independent, it is not possible for the filename to be anything other than
# the one used.
#
# However, below is an AWK script which will combine the parts together and
# uudecode them, then rename the file to either "tar.Z" or just "tar" if it
# wasn't compressed.
#
# The syntax for the script is
#
#decode part1 part2 part3 ...
#
#--Philip Colmer (pcolmer@acorn.co.uk)
#
# This is specific to the format used in comp.binaries.acorn,
# in particular it recognises the !Submit, !Extract structure.
BEGIN {ok=0;decoding=0;file=""}
# Following recognises the first begin line
/begin [0-9][0-9][0-9] / {ok=1;decoding=1;file=$3}
# And these are for subsequent archives
/begin part / {if (decoding) ok=1; next}
# Following is in case the archive headers are removed
/^M/ && (length == 61 || length == 62) {if (decoding) ok=1}
# The end of an archive
/^include/ {ok = 0;next}
# And just in case it is truncated
/^From:/ {ok = 0;next}
/^Path:/ {ok = 0;next}
/^Message/ {ok = 0;next}
# If ok decode the archive
{if (ok) print | "uudecode" }
# The archive end is marked by end at the line start
/^end/ {ok = 0;decoding=0;}
# Fix up the file name
END{
if (filename = "<SubExtWrk$Dir>.Work.File-Z")
print | "mv '" filename "' tar.Z";
else if (filename = "<SubExtWrk$Dir>.Work.File")
print | "mv '" filename "' tar";
}